const http = require("http");
// 引入url模块处理get传值
const url = require("url");

http.createServer(function (req, res) {

  // 处理传参
  if (req.url !== "/favicon.ico") {
    let info = url.parse(req.url, true).query;
    console.log(info);
  }

  res.writeHead(200, {"Content-Type": "text/html;charset=utf-8"});
  res.write("你好 nodejs");
  res.end();
}).listen(8081);

console.log("Server running at http://127.0.0.1:8081/");